﻿namespace VividKit.ComponentModel
{
    using System;
    using System.Threading.Tasks;
    using System.Windows;

    internal class Dispatcher : IDispatcher
    {
        Task IDispatcher.InvokeAsync(Action action)
        {
            return Application.Current.Dispatcher.InvokeAsync(action).Task;
        }

        Task<TResult> IDispatcher.InvokeAsync<TResult>(Func<TResult> callback)
        {
            return Application.Current.Dispatcher.InvokeAsync(callback).Task;
        }
    }
}